import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:DELL
 * Date:2024-10-15
 * Time:20:21
 */
public class Test {
    public static void main(String[] args) {
        int[] array={1,2,34,3,4,5,7,23,12};
        System.out.println(func5(array));
    }
    public static boolean func5(int[] array) {
        int count=0;
        for (int i = 0; i < array.length; i++) {
            if (array[i] % 2 == 1) {
                count++;
                if (count >= 3) {
                    return true;
                }
            } else {
                count = 0;
            }
        }
            return  false;
    }
    public static int func4(int[] array) {
        Arrays.sort(array);
        return array[array.length/2];
    }
    public static int func3(int[] array) {
        int ret=array[0];
        for (int i = 1; i < array.length; i++) {
            ret^=array[i];
        }
        return ret;
    }
    public static void main7(String[] args) {
        int[] array={2,2,3,3,1};
        int ret=func3(array);
        System.out.println(ret);
    }
    public static int[] func1(int[] array,int target) {
        for (int i = 0; i < array.length-1; i++) {
            for (int j = i+1; j < array.length; j++) {
                if(array[i]+array[j]==target){
                    return new int[]{i,j};
                }
            }
        }
        return new int[]{-1,-1};
    }
    public static void main6(String[] args) {
        int[] array={2,7,11,15};
        int[] ret=func1(array,9);
        System.out.println(Arrays.toString(ret));
    }
    public static void bubbleSort(int[] array) {
        boolean flag=false;
        for (int i = 0; i < array.length-1; i++) {
            for (int j = 0; j < array.length-1-i; j++) {
                if(array[j]>array[j+1]){
                    int tmp=array[j];
                    array[j]=array[j+1];
                    array[j+1]=tmp;
                    flag=true;
                }
            }
            if(flag==false){
                break;
            }
        }
    }
    public static void main3(String[] args) {
        int[] array={8,6,9,3,5,1};
        bubbleSort(array);
        System.out.println(Arrays.toString(array));
    }
    public static void func(int[] array) {
        int left=0;
        int right=array.length-1;
        while(left<right){
            while(left<right&&array[left]%2!=0){
                left++;
            }
            while(left<right&&array[right]%2==0){
                right--;
            }
            int tmp=array[left];
            array[left]=array[right];
            array[right]=tmp;
        }
    }
    public static void main5(String[] args) {
        int[] array={1,2,3,4,5,6};
        func(array);
        System.out.println(Arrays.toString(array));
    }
    public static double avg(int[] array) {
        int sum=0;
        for (int i = 0; i < array.length; i++) {
            sum+=array[i];
        }
        double ret=sum*1.0/array.length;
        return ret;
    }

    public static void main4(String[] args) {
        int[] array={1,2,3,4,5};
        double ret=avg(array);
        System.out.println(ret);
    }
    public static int[] tranfrom2(int[] array) {
        int[] ret=new int[array.length];
        for (int i = 0; i < array.length; i++) {
            ret[i]=array[i]*2;
        }
        return ret;
    }
    public static void main2(String[] args) {

        int[] array ={1,2,3};
        System.out.println(Arrays.toString(array));
        int[] ret=tranfrom2(array);
        System.out.println(Arrays.toString(ret));
    }
    public static void tranfrom(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i]=array[i]*2;
        }
    }
    public static void main1(String[] args) {

        int[] array ={1,2,3};
        System.out.println(Arrays.toString(array));
        tranfrom(array);
        System.out.println(Arrays.toString(array));
    }
}
